<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Script-Type" content="text/javascript" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<title>コントロールパネル</title>
		<link rel="stylesheet" href="./assets/styles/default.css" type="text/css" />
		<link rel="stylesheet" href="./assets/styles/ui-lightness/ui.all.css" type="text/css" />
		<script src="assets/scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
		<script src="assets/scripts/jquery-ui-1.7.3.custom.min.js" type="text/javascript"></script>
		<script src="assets/scripts/ui/ui.dialog.js" type="text/javascript"></script>
		<script src="assets/scripts/menu.js" type="text/javascript"></script>
		<script src="assets/scripts/table.js" type="text/javascript"></script>
		<script type="text/javascript" src="./assets/scripts/editor.js"></script>
		<script type="text/javascript" src="./assets/scripts/ui/ui.datepicker.js"></script>
		<script type="text/javascript" src="./assets/scripts/ui/ui.core.js"></script>
		<script type="text/javascript" src="./assets/scripts//table.js"></script>
		<script type="text/javascript" src="./assets/scripts/jquery.tablefix_1.0.0.js"></script>
		<link rel="stylesheet" href="./assets/styles/cellgrid.css" type="text/css" />
		<style type="text/css">
		</style>
		<script type="text/javascript">
	    function rObj(a1, a2) {
	        this.a1 = a1;
	        this.a2 = a2;
	    }
	    function rObj(a1, a2) {
	        this.a1 = a1;
	        this.a2 = a2;
	    }
		var map_disp = new Array();
		{{ foreach from=$title_map key=kk item=vv name="member" }}
		map_disp["{{$kk}}"] = new rObj("{{$vv[0] }}", "{{$vv[1]}}" );
		{{ /foreach }}
		
		var g_p_nums = new Array();
		{{ foreach from=$pattern_nums key=kk item=vv name="member" }}
			g_p_nums["{{$vv.shop_cd}}_{{$vv.pattern_cd}}"] = {{$vv.nums}};
		{{ /foreach }}
		
		var sp_map =new Array();
		{{ foreach from=$shopmapno key=kk item=vv name="member" }}
	sp_map["{{$kk}}"] = [ '{{$vv.r}}', '{{$vv.i}}', '{{$vv.l1}}', '{{$vv.l2}}', '{{$vv.l3}}', '{{$vv.l4}}', '{{$vv.l5}}'  ];
		{{ /foreach }}
		$(function() {
			$('.message').fadeIn("slow");
			//*******************
			$(".titlebase").live('change',function(){
				
				var id = $(this).attr("id") ;
				var index = id.split("_")[1] * 1 ;
				
				var shop_cd = $("#sp" + index).val() ; 
				var left_char = id.substr(0, 1) ;
				var vid = $(this).val();
				
				if  (left_char == "t") {
					if  ( !checkTitle(index) ){
						alert("通常と例外曜日のタイトル同時に入力不可です");
						 $(this).val("");
						return false;
					}
					$("#rgyu" + index).attr("value","");
					$("#irgyu" + index).attr("value","");
					$("#hirgyu" + index).attr("value","");
					var shop_map = "";
					
					if (map_disp[vid]!=null) {
						if (map_disp[vid].a1 == 1) {
							shop_map = sp_map[shop_cd][0];
						} else {
							shop_map = sp_map[shop_cd][1];
						}
						if  ( shop_map == "" ) {
							alert("マップNOは存在しないので、選択できできません。");
							$(this).val("");
							return false;
						}
						if (map_disp[vid].a1 == 1) {
							$("#rgyu" + index).attr("value", sp_map[shop_cd][0]);
						}
						if (map_disp[vid].a1 == 2) {
							$("#irgyu" + index).attr("value", sp_map[shop_cd][1]);
							$("#hirgyu" + index).attr("value", sp_map[shop_cd][1]);
						}
						
						if (map_disp[vid].a1 == 3) {
							$("#irgyu" + index).attr("value", map_disp[vid].a2);
							$("#hirgyu" + index).attr("value", sp_map[shop_cd][1]);
						}
					}
				}
				if  (left_char == "s") {
					var lIndex =  id.substr(1, 1);
					var lmapid = "#s"+ lIndex + index;
					if  ( vid == "" ) {
						$(lmapid).attr("value", "");
					} else {
						shop_map = sp_map[shop_cd][lIndex * 1 +1] ;
						if  ( shop_map == "" ) {
							alert("地域マップNOは存在しないので、選択できできません。");
							$(this).val("");
							return false;
						}
						$(lmapid).attr("value", shop_map);
					}
					
				}
				return "";
			});
			
			$(".spattern").live('change',function(){
				var val = $(this).val();
				var id = $(this).attr("id");
				var index = id.split("_")[2] * 1;
				theID = "n" + id;
				if (val == "" ) {
					$('#'+ theID ).val("");
				} else {
					var nums = getPNums($('#fm [name^=shop_cd]').eq(index).attr("value"),val) 
					$('#'+ theID ).val(nums);
				}
			});
			
			$('.btn_save').live('click',function(){
				if( confirm('更新してよろしいですか？') ){
					document.fm.mode.value = 'input';
					document.fm.submit();
				}
			});
			
			$('a.tddel').live('click',function(){
				$('#rtr_' + $(this).attr("id") ).remove();
				$(this).closest('tr').remove();
			});
		});
		
		function checkTitle (index){
			var titleFlag = false;
			if  ( $("#tx_" +index).val() != "" ) {
				titleFlag = true;
			}
{{ foreach from=$cell_wsets key=ck item=cv name="csets" }}
 {{assign var="jj" value=$smarty.foreach.csets.index}}
 			if  ( $("#t{{$jj}}_" + index ).val() != "" ) {
				if (titleFlag) {
					return false;
				}
				titleFlag = true;
			}
{{ /foreach }}
			return true;
		}
		function getPNums(shopcd,patterncd) {
			var vid =  shopcd + "_" + patterncd;
			if (vid in g_p_nums) {
				return g_p_nums[vid];
			}
			return "";
		}
	function hpa() {
		$("#pop_cp").hide();
		ginnerdiv = false;
	}
	function spa(val,text) {
		hpa();
		
		$("#"+gpatt_id).attr("value", text);
		var id  = gpatt_id.replace("nm", "")
		$("#" + id).attr("value", val);
		var index = id.split("_")[2] * 1;
		theID = "n" + id;
		var nums = "";
		if (val != "" ) {
			nums = getPNums($('#fm [name^=shop_cd]').eq(index).attr("value"),val) ;
		}
		
		$('#'+ theID ).val(nums);
		/*
		try{
			var group_no =  $("#"+gpatt_id).attr("ref") ;
			if (group_no) {
				 $("."+group_no).each(function(){
					   var patt_id =  $(this).attr("id") ;
					   $("#"+gpatt_id).attr("value", text);
				});
			}
		} catch(e) {
		 	
		}
		*/
	}
	var gpatt_id = null;
	var ginnerdiv = false;
	$(function(){
		$('.pnm').focus(function(){
			disppattern( $(this), "#pop_tp");
		});
		
		$('.pnq').focus(function(){
			disppattern( $(this), "#pop_qp");
		});
		
		document.onclick=function(e){ 
			var e=e?e:window.event; 
			var tar = e.srcElement||e.target; 
			if (!ginnerdiv) {
				if ( ( $(tar).attr("class") != "pnm") && ( $(tar).attr("class") != "pnq") ){ 
					hpa();
				} 
			}
		} 
	    $("#pop_cp").live("mouseenter",function(){
	    	ginnerdiv = true;
	    });
	    $("#pop_cp").live("mouseleave",function(){
	    	ginnerdiv = false
	    });
	});
	function disppattern(obj, val) {
		$('#pop_cp').html($(val).html() )
		var offset =  obj.offset();
		gpatt_id   =  obj.attr("id");
		var top = offset.top + obj.height() + 5 ;
		var bottom = document.body.scrollTop+document.body.clientHeight;
		if  (top + 350 >bottom) {
			top = bottom - 350;
		}
		var left  = offset.left + obj.width() - 380 ; 
		$('#pop_cp').css({
				'display':'block',
				'top': top +'px',
				'left':left+'px',
				'position':'absolute'
		});
	}
	
	function dorscroll(){
		document.getElementById('rdiv').scrollLeft=this.scrollLeft;
	}
			
			/** oota add **/
			var tableHeight = function(){
				var htr_h = $('#head_tab_r thead').height()-2;
				$('#head_tab_l th').css('height',htr_h+'px');
				
			}
			
			var tableFix = function(){
				$('#head_tab_r').tablefix({
					width: 793,
					height: 353,
					fixRows: 3
					
				});
			}
			function commonLoad(){
				tableFix();
				tableHeight();
			}
			
			$(window).resize(tableHeight).load(commonLoad);
			
		</script>
	</head>
	<style type="text/css">
		 table.formTable th,table.formTable td{
		 	white-space: 	nowrap;
		 	padding:		1px 5px;
		 }
	</style>
<body id="">
{{ $menu }}
{{ $logout }}
		<div id="container"><div class="wrapper">
			<h2>印刷手配管理</h2>
			<ul class="submenu clearfix">
				<li><a href="tmoncell_index.php">月間.セール明細情報一覧</a></li>
				<li><a href="tmoncell_form.php">月間.セール明細情報登録</a></li>
				<li>月間.セール明細情報更新</a></li>
				<li><a href="tmoncellprn_index.php">印刷部数明細</a></li>
				<li><a href="tmoncellshop_index.php">店舗実施一覧表</a></li>
			</ul>
			<h3>月間.セール明細情報更{{ if $phase == 'complete' }}完了{{ /if }}</h3>
{{ if $phase == 'input' }}
<p class="message">内容</p>
<form name="fm" id = "fm" action="tmoncell_updatef.php" method="post">
<p>	
	<b>週名 ： 
	{{ $forms.year4 }}年度 &nbsp; {{ $forms.week_cd }}週目 {{ if $forms.week_seq  }}  &nbsp; {{ $forms.week_seq }}回{{ /if }}
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;配布日 : {{ $forms.flier_date }}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	 ステータス : {{ $forms.status }}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;最終更新日時 :{{ $forms.u_time|date_format:"%Y/%m/%d %H:%M" }}</b>
	<input type="hidden" name="matrix_cd"  value="{{ $forms.matrix_cd }}" />
	<input type="hidden" name="aja_cd"  value="{{ $forms.aja_cd }}" />
	<input type="hidden" name="week_cd"    value="{{ $forms.week_cd }}" />
	<input type="hidden" name="year4"      value="{{ $forms.year4 }}" />
	<input type="hidden" name="week_seq"   value="{{ $forms.week_seq}}" />
	<input type="hidden" name="flier_date" value="{{ $forms.status}}" />
	<input type="hidden" name="status" value="{{ $forms.flier_date}}" />
	<input type="hidden" name="u_time"     value="{{ $forms.u_time }}" />
	{{if (!empty($edit_msg)) }}<div class="errmsg">{{ $edit_msg}}&nbsp;&nbsp; </div> {{ /if }}<div class="errmsg">{{ $errmsg}} </div>
</p>
 <table class="formTable" style="width:100%" >
 <tr><th colspan='3' >見込</th><th colspan='3'>計画</th><th colspan='3'>前年比</th></tr>
 <tr><td align="center">チラシ</td><td align="center">地域広告</td><td align="center">見込計</td>
 <td align="center">計画計</td><td align="center">計画差異</td><td align="center">計画比</td>
 <td align="center">前年計</td><td align="center">前年差異</td><td align="center">前年比</td></tr>
 <tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
 </table><br>
 <div class="l_head_div" id ="lhdiv">
 <table class="formTable" id = "head_tab_l" style="table-layout:fixed;word-wrap:break-word;word-break:break-all;" >
 <tr><th style="width:130px;height:80px">店舗コード<br/>店舗名<br/>(ゾーンAJA)</th>
 <th style="width:60px">見込計<br>チラシ<br>地域広告</th>
 <th style="width:60px">計画計<br>計画差異<br>計画比</th>
 <th style="width:60px">前年計<br>前年差異<br>前年比 </th>
 <th style="width:28px"></th>
 <th style="width:70px">前年<br>売上高<br>実績</th>
 </tr>
 {{ foreach from=$data key=kk item=vv name="member" }}
 {{assign var="i" value=$smarty.foreach.member.index}}
  <tr>
	<td rowspan=3> 
	<input type="text" id="sp{{$i}}"  name="shop_cd[]"     class="dtext" value="{{ $vv.shop_cd }}" readonly/></br>
	<input type="text" name="shop_name[]"   class="dtext" value="{{ $vv.shop_name }}" readonly/></br>
	<input type="text"  name="user_name[]" class="dtext" value="{{ $vv.user_name }}" readonly/>
	</td>
	<td rowspan=3> <input type="text"  id="rgyu{{$i}}" name="rgyu[]"   class="dtext" value="{{ $vv.rgyu }}" readonly/></td>
	<td rowspan=3> <input type="text" id="irgyu{{$i}}" name="irgyu[]"   class="dtext" value="{{ $vv.irgyu }}" readonly/>
	<input type="hidden"   id="hirgyu{{$i}}"  name="hirgyu[]"  id="hirgyu{{$i}}"  value="{{ $vv.hirgyu }}" /></td>
	
	<td rowspan=3> <input type="text" id="s1{{$i}}"  name="lnews1[]"   class="dtext" value="{{ $vv.lnews1 }}" readonly/></td>
	<td align=center>土</td><td><input type="text"  name="ly_sale6[]"   class="dtext" value="{{ $vv.lyear_sale6 }}" readonly/></td>

	</tr><tr><td align=center>日</td><td><input type="text"  name="ly_sale7[]"   class="dtext" value="{{ $vv.lyear_sale7 }}" readonly/></td></tr>
	<tr><td align=center>計</td><td><input type="text"  name="ly_sale[]"   class="dtext" value="{{ $vv.lyear_sale }}" readonly/></td></tr>
{{ /foreach }}
 
 </table>
 </div>
 <div class="r_head_div" id ="rhdiv">
 <table class="formTable" id = "head_tab_r"  style="word-wrap:break-word;word-break:break-all;">
<thead>
 	
 	 <tr style="height:26px;">
 	 <th style="height:26px;"colspan="6" > 通常チラシ </th>
 	 {{ foreach from=$cell_wsets key=ck item=cv name="csets" }}
 	 <th  colspan="4" >{{$cv.name}}シ </th>
 	{{ /foreach }} 
 	{{ foreach from=$cell_losets key=ck item=cv name="csets" }}
 	<th colspan="6" >{{$cv.name}}</th>
 	{{ /foreach }}
 	 </tr>
 	 <tr style="height:26px;">
 	 <th rowspan="2" style="">本年<br/>セールタイトル</th>
 	 <th rowspan="2"  style="width:28px"></th>
 	 <th colspan="2" style="height:26px;width:218px">前年</th>
 	 <th colspan="2" style="height:26px;width:218px">本年</th>
 	 {{ foreach from=$cell_wsets key=ck item=cv name="csets" }}
 	 <th  rowspan="2" style="">セールタイトル </th> <th style="width:28px;" rowspan="2"></th> <th  rowspan="2">本年<br>パターン </th><th rowspan="2">本年<br>部数</th>
 	{{ /foreach }}
 	{{ foreach from=$cell_losets key=ck item=cv name="csets" }}
 	 <th rowspan="2" style="width:220px;">本年<br/>セールタイトル</th> <th rowspan="2" style="width:28px;"></th>
 	 <th colspan="2" style="height:26px;">前年</th><th colspan="2">本年</th>
 	{{ /foreach }}
 	
 	 </tr>
 	 <tr  style="height:26px;">
 	 <th style="width:80px;height:26px;">部数</th>
 	 <th style="width:138px;">パターン</th> 
 	 <th style="width:80px;">部数</th>
 	 <th style="width:138px;">パターン</th>
 	 {{ foreach from=$cell_losets key=ck item=cv name="csets" }}
 	<th style="width:80px;height:26px;">部数</th><th style="width:138px;">パターン</th> <th style="width:80px;">部数</th><th style="width:138px;">パターン</th>
 	{{ /foreach }}
 	 
 	 </tr>
 </thead>
{{ foreach from=$data key=kk item=vv name="member" }}
 {{assign var="i" value=$smarty.foreach.member.index}}
	<tr>
	<td rowspan='3'><input type="text"  name="ltitle_cd[]"   class="dtext" value="{{ $vv.ltitle_cd }}" readonly/><br>
	<select  id="tx_{{$i}}" name="title_cd[]" class="titlebase"  > {{ html_options   options=$title selected=$vv.title_cd  }}</select></td>
	<td align=center style="width:20px!important;">B2</td>
	<td><input type="text"  name="lnpc_b2[]"   class="dtext" value="{{ $vv.lnpc_b2}}" readonly/></td>
	<td><input type="text"  name="lpc_b2[]"   class="dtext" value="{{ $vv.lpc_b2}}" readonly/></td>
	<td><input type="text"  id="npc_b2_{{$i}}"    name="npc_b2[]"   class="celltext" value="{{ $vv.npc_b2}}" /></td>
	<td><input type="text"  id="nmpc_b2_{{$i}}"  {{if $vv.mark == '1' }} ref="z{{$vv.group_no}}" {{/if}}  name="nmpc_b2[]" {{if $vv.mark == '9' }} class="z{{$vv.group_no}}" {{else}} class="pnm" {{/if}}  value="{{ $pattern[$vv.pc_b2] }}" readonly/>
	<input type="hidden"  id="pc_b2_{{$i}}"  name="pc_b2[]"   value="{{ $vv.pc_b2 }}" /></td>

{{ foreach from=$cell_wsets key=ck item=cv name="csets" }}
 {{assign var="jj" value=$smarty.foreach.csets.index}}
		<td rowspan='3'> <select  id="t{{$jj}}_{{$i}}" name="{{$cv.title_cd}}[]" class="titlebase" >{{ html_options name='' options=$title_week selected=$vv[$cv.title_cd]  }}</select></td>	
		<td align=center>B2</td>
		<td><input type="text"  id="{{$cv.npc_b2}}_{{$i}}" name="{{$cv.npc_b2}}[]"   class="celltext" value="{{ $vv[$cv.npc_b2]}}" /></td>
		 {{ assign var = "patt_cd" value = $vv[$cv.pc_b2] }}
		<td><input type="text"    id="nm{{$cv.pc_b2}}_{{$i}}" name="nm{{$cv.pc_b2}}[]"   class="pnm" value="{{ $pattern[$patt_cd]  }}" readonly/>
		<input type="hidden"  id="{{$cv.pc_b2}}_{{$i}}"  name="{{$cv.pc_b2}}[]"  value="{{ $patt_cd }}" /></td>
{{ /foreach }}
{{ foreach from=$cell_losets key=ck item=cv name="csets" }}
 {{assign var="jj" value=$smarty.foreach.csets.index}}
			
		<td rowspan='3'><input type="text"  name="{{$cv.ltitle_cd}}[]"   class="dtext" value="{{ $vv[$cv.ltitle_cd] }}" readonly/><br>
		 <select id="s{{$ck}}_{{$i}}"  name="{{$cv.title_cd}}[]" class="titlebase" >{{ html_options name='' options=$title selected=$vv[$cv.title_cd]  }}</select></td>	
		<td align=center>B2</td>
		<td><input type="text"  name="{{$cv.lnpc_b2}}[]"   class="dtext" value="{{ $vv[$cv.lnpc_b2] }}" readonly /></td>
		<td><input type="text"  name="{{$cv.lpc_b2}}[]"    class="dtext" value="{{ $vv[$cv.lpc_b2] }}"  readonly /></td>
		<td><input type="text"  id="{{$cv.npc_b2}}_{{$i}}" name="{{$cv.npc_b2}}[]"   class="celltext" value="{{ $vv[$cv.npc_b2]}}" /></td>
		 {{ assign var = "patt_cd" value = $vv[$cv.pc_b2] }}
		 <td><input type="text"    id="nm{{$cv.pc_b2}}_{{$i}}" name="nm{{$cv.pc_b2}}[]"   class="pnq" value="{{ $pattern[$patt_cd] }}" readonly/>
		<input type="hidden"   id="{{$cv.pc_b2}}_{{$i}}"  name="{{$cv.pc_b2}}[]"  value="{{ $patt_cd }}" /></td>
{{ /foreach }}
	</tr>
	<tr>
		
		<td align=center>B3</td>
		<td><input type="text"  name="lnpc_b3[]"   class="dtext" value="{{ $vv.lnpc_b3}}" readonly/></td>
		<td><input type="text"  name="lpc_b3[]"   class="dtext" value="{{ $vv.lpc_b3}}" readonly/></td>
		<td><input type="text"  id="npc_b3_{{$i}}" name="npc_b3[]"   class="celltext" value="{{ $vv.npc_b3}}" /></td>
		<td><input type="text"    id="nmpc_b3_{{$i}}" name="nmpc_b3[]"   class="pnm" value="{{ $pattern[$vv.pc_b3] }}" readonly/>
		<input type="hidden"  id="pc_b3_{{$i}}"  name="pc_b3[]"   value="{{ $vv.pc_b3 }}" /></td>
 {{ foreach from=$cell_wsets key=ck item=cv name="csets" }}
		<td align=center>B3</td>
		<td><input type="text"  id="{{$cv.npc_b3}}_{{$i}}" name="{{$cv.npc_b3}}[]"   class="celltext" value="{{ $vv[$cv.npc_b3]}}" /></td>
		 {{ assign var = "patt_cd" value = $vv[$cv.pc_b3] }}
		<td><input type="text"    id="nm{{$cv.pc_b3}}_{{$i}}" name="nm{{$cv.pc_b3}}[]"   class="pnm" value="{{ $pattern[$patt_cd]  }}" readonly/>
		<input type="hidden"  id="{{$cv.pc_b3}}_{{$i}}"  name="{{$cv.pc_b3}}[]"  value="{{ $patt_cd }}" /></td>
 {{ /foreach }}
{{ foreach from=$cell_losets key=ck item=cv name="csets" }}
		<td align=center>B3</td>
		<td><input type="text"  name="{{$cv.lnpc_b3}}[]"   class="dtext" value="{{ $vv[$cv.lnpc_b3] }}" readonly /></td>
		<td><input type="text"  name="{{$cv.lpc_b3}}[]"    class="dtext" value="{{ $vv[$cv.lpc_b3] }}"  readonly /></td>
		<td><input type="text"  id="{{$cv.npc_b3}}_{{$i}}" name="{{$cv.npc_b3}}[]"   class="celltext" value="{{ $vv[$cv.npc_b3]}}" /></td>
		 {{ assign var = "patt_cd" value = $vv[$cv.pc_b3] }}
		<td><input type="text"    id="nm{{$cv.pc_b3}}_{{$i}}" name="nm{{$cv.pc_b3}}[]"   class="pnq" value="{{ $pattern[$patt_cd]  }}" readonly/>
		<input type="hidden"  id="{{$cv.pc_b3}}_{{$i}}"  name="{{$cv.pc_b3}}[]"  value="{{ $patt_cd }}" /></td>

{{ /foreach }}
	</tr>
		<tr>
		
		<td align=center>B4</td>
		<td><input type="text"  name="lnpc_b4[]"   class="dtext" value="{{ $vv.lnpc_b4 }}" readonly/></td>
		<td><input type="text"  name="lpc_b4[]"   class="dtext" value="{{ $vv.lpc_b4 }}" readonly/></td>
		<td><input type="text"  id="npc_b4_{{$i}}" name="npc_b4[]"   class="celltext" value="{{ $vv.npc_b4 }}" /></td>
		<td><input type="text"    id="nmpc_b4_{{$i}}" name="nmpc_b4[]"   class="pnm" value="{{ $pattern[$vv.pc_b4] }}" />
		<input type="hidden"  id="pc_b4_{{$i}}"  name="pc_b4[]"   value="{{ $vv.pc_b4 }}" /></td>
 {{ foreach from=$cell_wsets key=ck item=cv name="csets" }}
		<td align=center>B4</td>
		<td><input type="text"  id="{{$cv.npc_b4}}_{{$i}}" name="{{$cv.npc_b4}}[]"   class="celltext" value="{{ $vv[$cv.npc_b4]}}" /></td>
		 {{ assign var = "patt_cd" value = $vv[$cv.pc_b4] }}
		<td><input type="text"    id="nm{{$cv.pc_b4}}_{{$i}}" name="nm{{$cv.pc_b4}}[]"   class="pnm" value="{{ $pattern[$patt_cd]  }}" readonly/>
		<input type="hidden"  id="{{$cv.pc_b4}}_{{$i}}"  name="{{$cv.pc_b4}}[]"  value="{{ $patt_cd }}" /></td>
 {{ /foreach }}
{{ foreach from=$cell_losets key=ck item=cv name="csets" }}
		<td align=center>B4</td>
		<td><input type="text"  name="{{$cv.lnpc_b4}}[]"   class="dtext" value="{{ $vv[$cv.lnpc_b4] }}" readonly /></td>
		<td><input type="text"  name="{{$cv.lpc_b4}}[]"    class="dtext" value="{{ $vv[$cv.lpc_b4] }}"  readonly /></td>
		<td><input type="text"  id="{{$cv.npc_b4}}_{{$i}}" name="{{$cv.npc_b4}}[]"   class="celltext" value="{{ $vv[$cv.npc_b4]}}" /></td>
		 {{ assign var = "patt_cd" value = $vv[$cv.pc_b4] }}
		<td><input type="text"    id="nm{{$cv.pc_b4}}_{{$i}}" name="nm{{$cv.pc_b4}}[]"   class="pnq" value="{{ $pattern[$patt_cd] }}" readonly/>
		<input type="hidden"  id="{{$cv.pc_b4}}_{{$i}}"  name="{{$cv.pc_b4}}[]"  value="{{ $patt_cd }}" /></td>

{{ /foreach }}
	</tr>
{{ /foreach }}
	</table>
 </div>
 <!--div class="l_div" id="ldiv" onscroll="document.getElementById('rdiv').scrollTop=this.scrollTop;"> 
 <table class="formTable" id = "1_tab_l" style="table-layout:fixed;word-wrap:break-word;word-break:break-all;" >
 <tr style="height:1px;">
 <th style="width:130px;height:1px"></th>
 <th style="width:60px"></th>
 <th style="width:60px"></th>
 <th style="width:60px"></th>
 <th style="width:28px"></th>
 <th style="width:70px"></th>
 </tr>
 {{ foreach from=$data key=kk item=vv name="member" }}
 {{assign var="i" value=$smarty.foreach.member.index}}
  <tr>
	<td rowspan=3> 
	<input type="text" id="sp{{$i}}"  name="shop_cd[]"     class="dtext" value="{{ $vv.shop_cd }}" readonly/></br>
	<input type="text" name="shop_name[]"   class="dtext" value="{{ $vv.shop_name }}" readonly/></br>
	<input type="text"  name="user_name[]" class="dtext" value="{{ $vv.user_name }}" readonly/>
	</td>
	<td rowspan=3> <input type="text"  id="rgyu{{$i}}" name="rgyu[]"   class="dtext" value="{{ $vv.rgyu }}" readonly/></td>
	<td rowspan=3> <input type="text" id="irgyu{{$i}}" name="irgyu[]"   class="dtext" value="{{ $vv.irgyu }}" readonly/>
	<input type="hidden"   id="hirgyu{{$i}}"  name="hirgyu[]"  id="hirgyu{{$i}}"  value="{{ $vv.hirgyu }}" /></td>
	
	<td rowspan=3> <input type="text" id="s1{{$i}}"  name="lnews1[]"   class="dtext" value="{{ $vv.lnews1 }}" readonly/></td>
	<td align=center>土</td><td><input type="text"  name="ly_sale6[]"   class="dtext" value="{{ $vv.lyear_sale6 }}" readonly/></td>

	</tr><tr><td align=center>日</td><td><input type="text"  name="ly_sale7[]"   class="dtext" value="{{ $vv.lyear_sale7 }}" readonly/></td></tr>
	<tr><td align=center>計</td><td><input type="text"  name="ly_sale[]"   class="dtext" value="{{ $vv.lyear_sale }}" readonly/></td></tr>
{{ /foreach }}
 </table>
 </div>
<div class="r_div" id="rdiv" onscroll="document.getElementById('rhdiv').scrollLeft=this.scrollLeft;document.getElementById('ldiv').scrollTop=this.scrollTop;hpa();"> 
	<table class="formTable" id = "1_tab_r"  style="table-layout:fixed;word-wrap:break-word;word-break:break-all;width:3000px">
	<tr style="height:1px;">
		<th style="height:1px;width:220px;"></th>
		<th style="width:28px;"></th><th style="width:80px;"></th><th></th>
		<th style="width:80px;"></th><th style="width:138px;"></th>
{{ foreach from=$cell_wsets key=ck item=cv name="csets" }}
		<th style="width:220px;"></th><th style="width:28px;"></th><th style="width:80px;"></th><th style="width:138px;"></th>
{{ /foreach }}
{{ foreach from=$cell_losets key=ck item=cv name="csets" }}
		<th style="width:220px;"></th><th style="width:28px;"></th><th style="width:80px;"></th><th></th> <th style="width:80px;"></th><th style="width:138px;"></th>
	{{ foreach from=$cv.weeks key=wck item=wcv name="cwsets" }}
		<th style="width:220px;"></th><th style="width:28px;"></th><th style="width:80px;"></th><th> style="width:138px;"</th>
	{{ /foreach }}
{{ /foreach }}
		</tr>
{{ foreach from=$data key=kk item=vv name="member" }}
 {{assign var="i" value=$smarty.foreach.member.index}}
	<tr>
	<td rowspan='3'><input type="text"  name="ltitle_cd[]"   class="dtext" value="{{ $vv.ltitle_cd }}" readonly/><br>
	<select  id="tx_{{$i}}" name="title_cd[]" class="titlebase"  > {{ html_options   options=$title selected=$vv.title_cd  }}</select></td>
	<td align=center>B2</td>
	<td><input type="text"  name="lnpc_b2[]"   class="dtext" value="{{ $vv.lnpc_b2}}" readonly/></td>
	<td><input type="text"  name="lpc_b2[]"   class="dtext" value="{{ $vv.lpc_b2}}" readonly/></td>
	<td><input type="text"  id="npc_b2_{{$i}}"    name="npc_b2[]"   class="celltext" value="{{ $vv.npc_b2}}" /></td>
	<td><input type="text"  id="nmpc_b2_{{$i}}"  {{if $vv.mark == '1' }} ref="z{{$vv.group_no}}" {{/if}}  name="nmpc_b2[]" {{if $vv.mark == '9' }} class="z{{$vv.group_no}}" {{else}} class="pnm" {{/if}}  value="{{ $pattern[$vv.pc_b2] }}" readonly/>
	<input type="hidden"  id="pc_b2_{{$i}}"  name="pc_b2[]"   value="{{ $vv.pc_b2 }}" /></td>

{{ foreach from=$cell_wsets key=ck item=cv name="csets" }}
 {{assign var="jj" value=$smarty.foreach.csets.index}}
		<td rowspan='3'> <select  id="t{{$jj}}_{{$i}}" name="{{$cv.title_cd}}[]" class="titlebase" >{{ html_options name='' options=$title_week selected=$vv[$cv.title_cd]  }}</select></td>	
		<td align=center>B2</td>
		<td><input type="text"  id="{{$cv.npc_b2}}_{{$i}}" name="{{$cv.npc_b2}}[]"   class="celltext" value="{{ $vv[$cv.npc_b2]}}" /></td>
		 {{ assign var = "patt_cd" value = $vv[$cv.pc_b2] }}
		<td><input type="text"    id="nm{{$cv.pc_b2}}_{{$i}}" name="nm{{$cv.pc_b2}}[]"   class="pnm" value="{{ $pattern[$patt_cd]  }}" readonly/>
		<input type="hidden"  id="{{$cv.pc_b2}}_{{$i}}"  name="{{$cv.pc_b2}}[]"  value="{{ $patt_cd }}" /></td>
{{ /foreach }}
{{ foreach from=$cell_losets key=ck item=cv name="csets" }}
 {{assign var="jj" value=$smarty.foreach.csets.index}}
			
		<td rowspan='3'><input type="text"  name="{{$cv.ltitle_cd}}[]"   class="dtext" value="{{ $vv[$cv.ltitle_cd] }}" readonly/><br>
		 <select id="s{{$ck}}_{{$i}}"  name="{{$cv.title_cd}}[]" class="titlebase" >{{ html_options name='' options=$title selected=$vv[$cv.title_cd]  }}</select></td>	
		<td align=center>B2</td>
		<td><input type="text"  name="{{$cv.lnpc_b2}}[]"   class="dtext" value="{{ $vv[$cv.lnpc_b2] }}" readonly /></td>
		<td><input type="text"  name="{{$cv.lpc_b2}}[]"    class="dtext" value="{{ $vv[$cv.lpc_b2] }}"  readonly /></td>
		<td><input type="text"  id="{{$cv.npc_b2}}_{{$i}}" name="{{$cv.npc_b2}}[]"   class="celltext" value="{{ $vv[$cv.npc_b2]}}" /></td>
		 {{ assign var = "patt_cd" value = $vv[$cv.pc_b2] }}
		 <td><input type="text"    id="nm{{$cv.pc_b2}}_{{$i}}" name="nm{{$cv.pc_b2}}[]"   class="pnq" value="{{ $pattern[$patt_cd] }}" readonly/>
		<input type="hidden"   id="{{$cv.pc_b2}}_{{$i}}"  name="{{$cv.pc_b2}}[]"  value="{{ $patt_cd }}" /></td>
{{ /foreach }}
	</tr>
	<tr>
		
		<td align=center>B3</td>
		<td><input type="text"  name="lnpc_b3[]"   class="dtext" value="{{ $vv.lnpc_b3}}" readonly/></td>
		<td><input type="text"  name="lpc_b3[]"   class="dtext" value="{{ $vv.lpc_b3}}" readonly/></td>
		<td><input type="text"  id="npc_b3_{{$i}}" name="npc_b3[]"   class="celltext" value="{{ $vv.npc_b3}}" /></td>
		<td><input type="text"    id="nmpc_b3_{{$i}}" name="nmpc_b3[]"   class="pnm" value="{{ $pattern[$vv.pc_b3] }}" readonly/>
		<input type="hidden"  id="pc_b3_{{$i}}"  name="pc_b3[]"   value="{{ $vv.pc_b3 }}" /></td>
 {{ foreach from=$cell_wsets key=ck item=cv name="csets" }}
		<td align=center>B3</td>
		<td><input type="text"  id="{{$cv.npc_b3}}_{{$i}}" name="{{$cv.npc_b3}}[]"   class="celltext" value="{{ $vv[$cv.npc_b3]}}" /></td>
		 {{ assign var = "patt_cd" value = $vv[$cv.pc_b3] }}
		<td><input type="text"    id="nm{{$cv.pc_b3}}_{{$i}}" name="nm{{$cv.pc_b3}}[]"   class="pnm" value="{{ $pattern[$patt_cd]  }}" readonly/>
		<input type="hidden"  id="{{$cv.pc_b3}}_{{$i}}"  name="{{$cv.pc_b3}}[]"  value="{{ $patt_cd }}" /></td>
 {{ /foreach }}
{{ foreach from=$cell_losets key=ck item=cv name="csets" }}
		<td align=center>B3</td>
		<td><input type="text"  name="{{$cv.lnpc_b3}}[]"   class="dtext" value="{{ $vv[$cv.lnpc_b3] }}" readonly /></td>
		<td><input type="text"  name="{{$cv.lpc_b3}}[]"    class="dtext" value="{{ $vv[$cv.lpc_b3] }}"  readonly /></td>
		<td><input type="text"  id="{{$cv.npc_b3}}_{{$i}}" name="{{$cv.npc_b3}}[]"   class="celltext" value="{{ $vv[$cv.npc_b3]}}" /></td>
		 {{ assign var = "patt_cd" value = $vv[$cv.pc_b3] }}
		<td><input type="text"    id="nm{{$cv.pc_b3}}_{{$i}}" name="nm{{$cv.pc_b3}}[]"   class="pnq" value="{{ $pattern[$patt_cd]  }}" readonly/>
		<input type="hidden"  id="{{$cv.pc_b3}}_{{$i}}"  name="{{$cv.pc_b3}}[]"  value="{{ $patt_cd }}" /></td>

{{ /foreach }}
	</tr>
		<tr>
		
		<td align=center>B4</td>
		<td><input type="text"  name="lnpc_b4[]"   class="dtext" value="{{ $vv.lnpc_b4 }}" readonly/></td>
		<td><input type="text"  name="lpc_b4[]"   class="dtext" value="{{ $vv.lpc_b4 }}" readonly/></td>
		<td><input type="text"  id="npc_b4_{{$i}}" name="npc_b4[]"   class="celltext" value="{{ $vv.npc_b4 }}" /></td>
		<td><input type="text"    id="nmpc_b4_{{$i}}" name="nmpc_b4[]"   class="pnm" value="{{ $pattern[$vv.pc_b4] }}" />
		<input type="hidden"  id="pc_b4_{{$i}}"  name="pc_b4[]"   value="{{ $vv.pc_b4 }}" /></td>
 {{ foreach from=$cell_wsets key=ck item=cv name="csets" }}
		<td align=center>B4</td>
		<td><input type="text"  id="{{$cv.npc_b4}}_{{$i}}" name="{{$cv.npc_b4}}[]"   class="celltext" value="{{ $vv[$cv.npc_b4]}}" /></td>
		 {{ assign var = "patt_cd" value = $vv[$cv.pc_b4] }}
		<td><input type="text"    id="nm{{$cv.pc_b4}}_{{$i}}" name="nm{{$cv.pc_b4}}[]"   class="pnm" value="{{ $pattern[$patt_cd]  }}" readonly/>
		<input type="hidden"  id="{{$cv.pc_b4}}_{{$i}}"  name="{{$cv.pc_b4}}[]"  value="{{ $patt_cd }}" /></td>
 {{ /foreach }}
{{ foreach from=$cell_losets key=ck item=cv name="csets" }}
		<td align=center>B4</td>
		<td><input type="text"  name="{{$cv.lnpc_b4}}[]"   class="dtext" value="{{ $vv[$cv.lnpc_b4] }}" readonly /></td>
		<td><input type="text"  name="{{$cv.lpc_b4}}[]"    class="dtext" value="{{ $vv[$cv.lpc_b4] }}"  readonly /></td>
		<td><input type="text"  id="{{$cv.npc_b4}}_{{$i}}" name="{{$cv.npc_b4}}[]"   class="celltext" value="{{ $vv[$cv.npc_b4]}}" /></td>
		 {{ assign var = "patt_cd" value = $vv[$cv.pc_b4] }}
		<td><input type="text"    id="nm{{$cv.pc_b4}}_{{$i}}" name="nm{{$cv.pc_b4}}[]"   class="pnq" value="{{ $pattern[$patt_cd] }}" readonly/>
		<input type="hidden"  id="{{$cv.pc_b4}}_{{$i}}"  name="{{$cv.pc_b4}}[]"  value="{{ $patt_cd }}" /></td>

{{ /foreach }}
	</tr>
{{ /foreach }}
	</table>
</div-->
<div class = "all_div">
	<p  class="button" >
		<button type="button" class="btn_save"  class="submit btnleft"><span>更新</span></button>
	</p>
	<input type="hidden" name="mode" value="" />
</div>
</form>
{{ /if }}

{{ if $phase == 'complete' }}
	<p class="message">{{ $message }}</p>
	<ul>
		<li>>> <a href="tmoncell_index.php?hist=2">一覧ページに戻る</a></li>
		<li>>> <a href="tmoncell_formf.php?mm={{ $forms.map_no }}&ww={{ $forms.matrix_cd }}">更新</a></li>
	</ul>
{{ /if }}
		</div>
		</div>
 <div id="pop_cp" style = "width:380px; height:300px;background:#eeeecc;  overflow-y:scroll;display:none" > </div>
   <div id="pop_tp" style = "display:none" >
 <table width="98%" border="0" cellspacing="2" cellpadding="0" style="font-size:12px; line-height:17px;">
  <tr><td align="right" colspan=4><button type="button" onclick="javascript:spa('','')" ><span>クリア</span></button>&nbsp;&nbsp;</td></tr>
 {{ foreach from=$allpattern key=k item=v name="cs" }}
 {{ if  ($k == 1) ||  ($k == 2) ||  ($k == 5)   }} 
 <tr><td align="left"><b>{{$patternflags[$k]}}</b></td></tr>
 <tr>
	 {{ foreach from=$v key=pk item=pv name="csets" }}
	 	<td align="left">
	  <a href="javascript:void(0)" onclick="javascript:spa('{{$pk}}','{{$pv}}')" > {{$pv}} </a>
	   </td>
	    {{if $smarty.foreach.csets.index % 4 == 3}}</tr><tr>{{/if}}
	 {{ /foreach }}
  {{ /if }}
 {{ /foreach }}
 </table>
 </div>
  <div id="pop_qp"  style = "display:none" >
 <table width="98%" border="0" cellspacing="2" cellpadding="0" style="font-size:12px; line-height:17px;">
  <tr><td align="right" colspan=4><button type="button" onclick="javascript:spa('','')" ><span>クリア</span></button>&nbsp;&nbsp;</td></tr>
 {{ foreach from=$allpattern key=k item=v name="cs" }}
 {{ if  ($k == 2) ||  ($k == 3) ||  ($k == 4)   }} 
 <tr><td align="left"><b>{{$patternflags[$k]}}</b></td></tr>
 <tr>
	 {{ foreach from=$v key=pk item=pv name="csets" }}
	 	<td align="left">
	  <a href="javascript:void(0)" onclick="javascript:spa('{{$pk}}','{{$pv}}')" > {{$pv}} </a>
	   </td>
	    {{if $smarty.foreach.csets.index % 4 == 3}}</tr><tr>{{/if}}
	 {{ /foreach }}
  {{ /if }}
 {{ /foreach }}
 </table>
 </div>
<div class = "all_div" >{{ $footer }}</div>
	</body>
</html>